package org.gwt.grin.client.util;

import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.ui.Widget;

public class BgImage {

	protected final String url;
	protected final String repeat;
	protected final String position;
	
	public BgImage(String url, String repeat, String position) {
		this.url = url;
		this.repeat = repeat;
		this.position = position;
	}

	public String getUrl() {
		return url;
	}

	public String getRepeat() {
		return repeat;
	}

	public String getPosition() {
		return position;
	}
	
	public void applyTo(Widget w) {
		Style s = w.getElement().getStyle();
		s.setBackgroundImage(url);
		s.setProperty("backgroundRepeat", repeat);
		s.setProperty("backgroundPosition", position);
	}
}
